<?php
declare(strict_types=1);

namespace App\AdminApi\Api;

use App\AdminApi\AdminApiBasicsController;
use Hyperf\HttpServer\Annotation\Controller;
use Hyperf\HttpServer\Annotation\GetMapping;
use Psr\Http\Message\ResponseInterface;
use Zms\Guard\Auth;
use Zms\Guard\AuthUnit;
use zms\HyperfResponse\Response;

#[
    Controller(prefix: "/admin-api/filter-panel", server: self::SERVER),
    Auth(guard: self::GUARD, sign: "skip", app: self::APP)
]
class FilterPanelController extends AdminApiBasicsController
{
    #[
        GetMapping('permissions-data'),
        Auth(label: ['权限节点数据'], logger: false)
    ]
    public function permissionsData(): ResponseInterface
    {
        $data = AuthUnit::permissionsFormData('admin');
        return Response::Api()->success(data: $data);
    }
}